class UserController < ApplicationController
  alias_method :engine_login, :login
  alias_method :engine_signup, :signup
  
  def signup
    if request.user_agent.index "EVE-minibrowser"
      unless request.env['HTTP_EVE.TRUSTED'] == 'yes'
        response.headers['eve.trustme'] = 'http://dell.sander.net:3000/::Please trust me, to proccess your registration'
        flash[:notice] = "You have to add this page to your trusted website."
        render :action => 'login'
      else
        flash[:notice] = 'Thanks'
        params[:user][:login] = request.env['HTTP_EVE.CHARNAME'] if request.method == :post
        engine_signup
      end
    else
      flash[:notice] = "Please register with the IGB."
      redirect_to :action => 'login'
    end
  end
  
    # Generate a template user for certain actions on get
  def generate_blank
    case request.method
    when :get
      @user = User.new
      @user.login = request.env['HTTP_EVE.CHARNAME']
      render
      return true
    end
    return false
  end

end
